#!/usr/bin/env python3

# http://www.upriss.org.uk/python/session4.html

# 2.2) Modify the program so that it asks users whether they want to
# guess again each time. Use two variables, number for the number and
# answer for the answer to the question whether they want to continue
# guessing. The program stops if the user guesses the correct number
# or answers "no". (In other words, the program continues as long as a
# user has not answered "no" and has not guessed the correct number.)

number = -1
answer = "yes"
lucky_number = 24

while number != lucky_number or answer != "stop":
    m = input("Geef een getal of geef 'stop' om te stoppen: ")
    if (m.isdigit()):
        print("is digit: ", m)
        number = int(m)
        if number == lucky_number:
            print("lucky_number")
            break
    else:
        print("string: ", m)
        answer = m
        if answer == "stop":
            print("stop")
            break
